package com.dhcc.repository;

import com.dhcc.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface UserRepository extends JpaRepository<User, Integer> {
    List<User> findUserByUsername(String username);

    @Query(value = "select u.* from user u where u.username = :username", nativeQuery = true)
    List<User> etUser(@Param("username") String username);

    @Query(value = "select count(*) from user u",nativeQuery = true)
    Integer getCount();

    @Query(value = "select u.* from user u limit :startIndex,:pageCount",nativeQuery = true)
    List<User> getUser(@Param("startIndex") Integer startIndex,@Param("pageCount") Integer pageCount);
}
